<?php
namespace App\Services\Sms;

use App\Services\ProjectValidate;
/**
 * @Author: Marte
 * @Date:   2017-05-27 16:25:13
 * @Last Modified by:   ws
 * @Last Modified time: 2018-06-12 10:16
 */
class ValidateVerify extends ProjectValidate
{
    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        if (!empty($initData['orther_info'])) {
            $this->rules['orther_info']  = 'required';
        }
        if (!empty($initData['to_uid'])) {
            $this->rules['to_uid']  = 'required|integer|min:0|different:from_uid';
        }
        if (!empty($initData['to_uid_m'])) {
            $this->rules['to_uid_m']  = 'array|min:1|different:from_uid';
        }
        if (!empty($initData['id'])) {
            $this->rules['id']  = 'array|min:1';
        }
      

    }
    
    public $rules = [
        'id'             => 'int|min:1',
        'user_id'        => 'int|min:1',
        'from_uid'       => 'int|min:1',
        'to_uid'         => 'array|different:from_uid',
        'title'          => 'string|min:2|max:50',
        'content'        => 'string|min:5|max:500',
        'type'           => 'in:0,1,2,',
        //'msgType'        => 'in(['receive', 'send'])'
        'from_user_name' => 'min:2',
        'to_user_name'   => 'min:2',
        'page'           => 'int|min:1',
        'listRows'       => 'integer|min:1|max:100'
    ];
   
  /* Validator::make($data, [
    'zones' => [
        'required',
        Rule::in(['first-zone', 'second-zone']),
    ],
]);*/

    public $messages = [
       
    ];

    /**
     * @var array 上面规则中定义的 key 的名字
     */
    public $attributes = [
      
    ];
}